package com.myworld.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.myworld.model.Person;
import com.myworld.service.PersonService;

@Controller
public class RedisCacheControler {
	
	@Autowired
	private PersonService personService;
	
	@RequestMapping("test")
	public void test(){
		try {
			int i=1;
			
			Person  p=personService.findById("1");
			Person  p1=personService.findById1("1");
			System.out.println(p+"-----------------"+i++);
			System.out.println(p1+"-----------------"+i++);
			
			Person  p2=personService.findById("1");
			Person  p3=personService.findById1("1");
			System.out.println(p2+"-----------------"+i++);
			System.out.println(p3+"-----------------"+i++);
			
			personService.deleteFromCache("1");
			
			Person  p4=personService.findById("1");
			Person  p5=personService.findById1("1");
			System.out.println(p4+"-----------------"+i++);
			System.out.println(p5+"-----------------"+i++);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
